# -*- coding: utf-8 -*-
# @Time        :2025/8/1 上午11:10
# @Author      :文刀水寿
# @File        : 函数线程.py
"""
 @Description :
"""
import threading
import time


def sing(round_num):
    print(f"唱歌 --------{round_num}")
    time.sleep(1)  # 模拟耗时操作


def dance(round_num):
    print(f"跳舞------{round_num}")
    time.sleep(1)  # 模拟耗时操作


if __name__ == '__main__':
    for i in range(3):  # 共3轮
        # 每次循环创建新线程，并传入当前轮次（避免共享变量竞争）
        t1 = threading.Thread(target=sing, args=(i,))  # args传递参数
        t2 = threading.Thread(target=dance, args=(i,))

        t1.start()
        t2.start()

    print("所有轮次执行完毕\n")
